package com.eleven.mall.controller;

import com.eleven.mall.pojo.Rbody;
import com.eleven.mall.utils.JwtUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: Rui_simple
 * @Date: 2022/10/19 21:55
 * @Description: HelloController
 * @Version 1.0.0
 */
@RestController
@CrossOrigin
public class HelloController {
    @GetMapping("/hello")
    public String Hello(){
        return "hello wuqiufang！help me！";
    }

    @GetMapping("/token")
    public Rbody testToken() {
        Rbody rbody = new Rbody();
        // 创建token， 返回给 用户
        String token = JwtUtils.createToken("500", "admin");
        rbody.setData(token);

        rbody.getMeta().setMsg("令牌获取成功 ！");
        return rbody;
    }
}
